The present invention relates to a random-number generating method and an apparatus and a storage medium therefor. More particularly, it relates to a random-number generating method and an apparatus and a storage medium therefor that, on a parallel computer having a plurality of processors, make it possible to generate M sequence (maximum-length linearly recurring sequence) random numbers having a plurality of phase types.
As conventional techniques concerning random-number generating systems, there have been known techniques disclosed in literatures such as xe2x80x9cRandom Numbersxe2x80x9d by Masanori Fushimi (Tokyo University Press) and JP-A-6-202856. The former conventional technique relates to a theory about a system in which, in order for each of processors on a parallel computer to generate independent M sequence random numbers, the respective processors generate the M sequence random numbers having a different phase type. Also, the latter conventional technique relates to a system in which initial values are distributed so that a certain processor on the parallel computer can generate random numbers that are independent of random numbers generated by the other processors, thereby allowing the respective processors to independently generate the random numbers and making it possible to perform high rate generation of the random numbers.
The random-number generating systems according to the above-described two conventional techniques allow the respective processors on the parallel computer to generate the independent random numbers by independent processings, respectively, thus making it possible to perform the high rate generation processing of the random numbers with no communication overhead. In these conventional techniques, however, there exists no member of specifying which processor generates which phase type of random numbers. This condition necessarily results in a fact that, if the processor number is determined, the type of generated random numbers will be determined uniquely.
Generally speaking, in processing a numerical simulation in which, with random numbers being generated, the execution is performed by using the random numbers, there has been known the following: If, during the parallel execution, the solution is found to be invalid on a specific processor, it is effective in verifying the validity to perform a re-execution of the simulation by providing random numbers generated on another processor onto the processor on which the solution is found to be invalid. What is needed for the re-execution is that it is obvious which processor is generating which phase type of random numbers.
In the random-number generating systems according to the above-described conventional techniques, there exists no member of specifying which processor generates which phase type of random numbers. Moreover, there exists no member of exchanging generated random numbers between the processors such as, for example, generating, on a processor of logical processor number 7, random numbers that have been generated on a processor of logical processor number 0 up to now. On account of these features, the systems have a problem that they are unsuitable for being applied to the generation of random numbers in the parallel computer executing the numerical simulation as described above.
It is an object of the present invention to provide a random-number generating method and an apparatus and a storage medium therefor that specify a different phase type to each of a plurality of processors constituting a parallel computer so as to generate M sequence random numbers having the phase type. It is another object of the present invention to provide a random-number generating method and an apparatus and a storage medium therefor that make it possible to change a phase type of the random numbers that each processor is caused to generate.
In a random-number generating method in which a parallel computer having a plurality of processors is used so as to generate random numbers having a plurality of phase types, the above-described objects are accomplished in the following manner: Any one of the processors manages processors generating the random numbers and phase types used for generating the random numbers by the processors generating the random numbers in such a manner that the processors and the phase types are in correspondence with each other, and the processors generating the random numbers generate the random numbers of the phase types being in correspondence therewith. Moreover, the above-described objects are accomplished in the following manner: A first processor manages second and third processors and phase types used for generating the random numbers by the second and third processors in such a manner that the processors and the phase types are in correspondence with each other, and the second and third processors generate the random numbers of the phase types being in correspondence therewith. Also, in a random-number generating method in which a parallel computer having a plurality of processors is used so as to generate random numbers having a plurality of phase types, the above-described objects are accomplished in the following manner: Two pieces of information, i.e. the number of phase types of random numbers to be generated and information specifying which phase type of random numbers each of the processors generates, are inputted, and the processors generate random numbers of the phase types specified out of the phase types by the number of the phase types. Moreover, the above-described objects are accomplished in the following manner: The processors, receiving the inputted information, create a management table that manages the processors and the phase types of random numbers to be generated in such a manner that the processors and the phase types are in correspondence with each other, and the processors generate random numbers of phase types specified based on the management table. Furthermore, the above-described objects are accomplished in the following manner: A first processor, receiving the inputted information, creates the management table, and a second processor generates random numbers of phase types specified based on the created management table. In addition, the above-described objects are accomplished by creating the management table that manages the plurality of processors in such a manner that the processors are in correspondence with the phase types of random numbers that are different from each other. In addition, the above-described objects are accomplished in the following manner: Each of the processors creates initial value tables by the number of the phase types, and, out of the created initial value tables, selects an initial value table for generating the random numbers of the phase types specified based on the management table, and generates random numbers of phase types specified based on the selected initial value table. In addition, the above-described objects are accomplished in the following manner: Each of the processors generates, at a plurality of times, random numbers of one phase type specified based on the selected initial value table. In addition, the above-described objects are accomplished by changing the correspondence relation between the processors managed by the management table and the phase types of the random numbers to be generated and exchanging, between the processors, the phase types of the random numbers to be generated. Also, in a random-number generating method in which a parallel computer having a plurality of processors is used so as to generate random numbers having a plurality of phase types, the above-described objects are accomplished in the following manner: Two pieces of information, i.e. the number of the processors used and information specifying which phase type of random numbers each of the processors generates, are inputted. Then, the processors, from the number of the processors used, determine the number of phase types of random numbers to be generated and generate random numbers of the phase types specified out of the phase types by the number of the phase types. Also, in a random-number generating apparatus that includes a plurality of processors and generates random numbers having a plurality of phase types, the above-described objects are accomplished in the following manner: The processors include a management member that manages the processors and the phase types of the random numbers to be generated in such a manner that the processors and the phase types are in correspondence with each other, and include a random-number calculating member that receives information from the management member so as to calculate the random numbers of the phase types being in correspondence the processors. Moreover, the above-described objects are accomplished in the following manner: A first processor includes the management member, and a second processor includes the random-number calculating member. Furthermore, the above-described objects are accomplished in the following manner: The processors include a changing member of changing the correspondence relation between the processors and the phase types of the random numbers to be generated. In addition, the above-described objects are accomplished in the following manner: The management member manages the plurality of processors in such a manner that the processors are in correspondence with the phase types of random numbers that are different from each other. Incidentally, the above-described objects can also be accomplished by using a storage medium that stores a random-number generating program capable of executing the functions embodied by the above-described method and apparatus.